/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lixo;

import br.com.geftu.model.Participa;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;

import com.towel.bean.Formatter;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author jorgenei
 */
@Entity
@Table(name = "tb_funcao")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Funcao.findAll", query = "SELECT t FROM Funcao t"),
    @NamedQuery(name = "Funcao.findByIdfunc", query = "SELECT t FROM Funcao t WHERE t.idfunc = :idfunc"),
    @NamedQuery(name = "Funcao.findByFuncao", query = "SELECT t FROM Funcao t WHERE t.funcao = :funcao"),
    @NamedQuery(name = "Funcao.findByLocalizacao", query = "SELECT t FROM Funcao t WHERE t.localizacao = :localizacao")})
public class FuncaoTeste implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "funcao")
    private Collection<Participa> ParticipaCollection;

    /**
     * @return the serialVersionUID
     */
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    /**
     * @param aSerialVersionUID the serialVersionUID to set
     */
    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static long serialVersionUID = 1L;
    @Id 
    @SequenceGenerator(name="idfunc", sequenceName="funcao_seq", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="idfunc")
    @Basic(optional = false)
    @Column(name = "idfunc")
    private Integer idfunc;
    @Column(name = "funcao")
    private String funcao;
    @Column(name = "localizacao")
    private String localizacao;

    /**
     * @return the changeSupport
     */
    public PropertyChangeSupport getChangeSupport() {
        return changeSupport;
    }

    /**
     * @param changeSupport the changeSupport to set
     */
    public void setChangeSupport(PropertyChangeSupport changeSupport) {
        this.changeSupport = changeSupport;
    }

    /**
     * @return the idfunc
     */
    public Integer getIdfunc() {
        return idfunc;
    }

    /**
     * @param idfunc the idfunc to set
     */
    public void setIdfunc(Integer idfunc) {
        this.idfunc = idfunc;
    }

    /**
     * @return the funcao
     */
    public String getFuncao() {
        return funcao;
    }

    /**
     * @param funcao the funcao to set
     */
    public void setFuncao(String funcao) {
        this.funcao = funcao;
    }

    /**
     * @return the localizacao
     */
    public String getLocalizacao() {
        return localizacao;
    }

    /**
     * @param localizacao the localizacao to set
     */
    public void setLocalizacao(String localizacao) {
        this.localizacao = localizacao;
    }
    
    @Override
    public String toString() {
        return funcao;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idfunc != null ? idfunc.hashCode() : 0);
        return hash;
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final FuncaoTeste other = (FuncaoTeste) obj;
        if (!Objects.equals(this.changeSupport, other.changeSupport)) {
            return false;
        }
        if (!Objects.equals(this.idfunc, other.idfunc)) {
            return false;
        }
        if (!Objects.equals(this.funcao, other.funcao)) {
            return false;
        }
        if (!Objects.equals(this.localizacao, other.localizacao)) {
            return false;
        }
        return true;
    }

    public FuncaoTeste() {
    }

    @XmlTransient
    public Collection<Participa> getParticipaCollection() {
        return ParticipaCollection;
    }

    public void setParticipaCollection(Collection<Participa> ParticipaCollection) {
        this.ParticipaCollection = ParticipaCollection;
    }

  
}
